<template>

	<view class="page" :style="{'min-height':h+'px','padding-top':(mt)+'px'}">
		<c-nav-bar1 title="退款详情"></c-nav-bar1>
		<view class="bg"></view>

		<view class="t_top box">
			<text class="title" v-if="item.orderState==6">退款中</text>
			<text class="title" v-if="item.orderState==7">已退款</text>
			<image src="https://i.ringzle.com/file/20240304/0b8d658940694e3692a1e7a0b89b6a31.png"></image>
			<view class="tt_text">
				<view>提交订单</view>
				<view>退款审核</view>
				<view v-if="item.orderState==6">审核中</view>
				<view v-if="item.orderState==7">审核通过</view>
			</view>
		</view>
		<view class="t_money box">
			<view class="tm_top">
				<view class="tmt_left">退款总额</view>
				<view class="tmt_right">￥<text>{{item.price}}</text></view>
			</view>
			<text>扣除手续费 ￥{{item.sxf==0?'0.00':item.sxf.toFixed(2)}}</text>
		</view>
		<view class="t_info box">
			<view class="tm_top">
				<view class="tmt_left">原路退回</view>
				<view class="tmt_right"><span>预计</span>￥<text>{{item.price}}</text></view>
			</view>
			<view class="ti_line"></view>
			<view class="vi_box">
				<view v-for="(his,index) in histories" :key="index">
					<image :src="his.image"></image>
					<view class="vb_title">
						<text>{{his.title}}</text>
						<text>{{his.tkDateTime}}</text>
					</view>
					<view class="vb_tip">{{his.tip}}</view>
					<view class="vb_tip">{{his.dateTime}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'refundDetails',
		data() {
			return {
				h: uni.getWindowInfo().windowHeight - 60,
				mt: uni.getSystemInfoSync().statusBarHeight + 44,
				titleStyle: {
					fontSize: '36rpx',
					fontWeight: "bold",
					color: "#FFFFFF"
				},
				item: null,
				histories: [{
						image: 'https://i.ringzle.com/file/20231110/ff5b04827e4e4b7bbbe2ddff21e59770.png',
						title: '退款审核',
						tkDateTime: '',
						tip: '正在审核您的退款请求',
						dateTime: '2023-10-08 19:17:38'
					},
					{
						image: 'https://i.ringzle.com/file/20231110/d9b5debadfa845baa5954242fc408efe.png',
						title: '提交订单',
						tkDateTime: '',
						tip: '您已发起退款申请',
						dateTime: ''
					}
				]
			}
		},
		onLoad(option) {
			let obj = JSON.parse(option.item)
			this.item = obj;
			this.item.price = this.item.isRefundInfoDTO?(this.item.isRefundInfoDTO.amount||0):0;
			let amount = this.item.isRefundInfoDTO?(this.item.isRefundInfoDTO.amount||0):0;
			this.item.sxf = parseFloat(this.item.realityPay)-parseFloat(amount);
			this.histories[0].dateTime = this.histories[0].tkDateTime = new Date().Format('yyyy-MM-dd hh:mm:ss');
		},
		methods: {
			copyOrderNo() {
				let that = this;
				// #ifdef H5
				this.$copyText(this.item.orderId).then(res => {
					this.$showToast('复制成功');
				})
				// #endif
				// #ifdef MP-WEIXIN
				uni.setClipboardData({
					data: this.item.orderId,
					success(res) {
						that.$showToast('复制成功');
					},
					fail(err) {
						that.$showToast('复制失败');
					}
				})
				// #endif
			}
		}
	}
</script>

<style scoped lang="less">
	.page {
		background: #F5F8FA;
		display: flex;
		align-items: center;
		flex-direction: column;
		padding-bottom: 140rpx;

		.bg {
			// width: 100%;
			// height: 702rpx;
			// position: absolute;
			// top: 0;
			// left: 0;
			// z-index: 0;
			height: 860rpx;
			position: fixed;
			top: 44px;
			z-index: 1;
			width: 100%;
			background-image: linear-gradient(to bottom, #007A69, #007A69, #F5F8FA);


		}

		.box {
			width: calc(100% - 96rpx);
			background: #FFFFFF;
			border-radius: 16rpx;
			margin-top: 20rpx;
			z-index: 1;
		}

		.t_top {
			display: flex;
			flex-direction: column;
			margin-top: 40rpx;
			width: calc(100% - 48rpx);
			background: transparent;
			padding: 0 24rpx;

			.title {
				font-size: 36rpx;
				font-family: PingFang-SC-Bold, PingFang-SC;
				font-weight: bold;
				color: #FFFFFF;
				text-indent: 30rpx;
			}

			&>image {
				width: calc(100% - 60rpx);
				height: 36rpx;
				margin: 36rpx 30rpx 0;
			}

			.tt_text {
				display: flex;
				align-items: center;
				justify-content: space-around;
				margin-top: 24rpx;
				text-align: center;

				view {
					width: calc(100% / 3);
					font-size: 24rpx;
					font-family: PingFang-SC-Bold, PingFang-SC;
					font-weight: bold;
					color: #FFFFFF;

					&:first-child {
						text-align: left;
					}

					&:last-child {
						text-align: right;
					}
				}
			}
		}

		.t_money {
			padding: 48rpx 24rpx;
			display: flex;
			flex-direction: column;
			margin-top: 40rpx;

			.tm_top {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.tmt_left {
					font-size: 36rpx;
					font-family: PingFang-SC-Bold, PingFang-SC;
					font-weight: bold;
					color: #333333;
				}

				.tmt_right {
					display: flex;
					align-items: center;
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #FF4141;

					text {
						font-size: 36rpx;
						font-family: DINAlternate-Bold, DINAlternate;
						font-weight: bold;
						color: #FF4141;
					}
				}
			}

			&>text {
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #808080;
				margin-top: 36rpx;
			}
		}

		.t_info {
			padding: 48rpx 24rpx 45rpx;

			.tm_top {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.tmt_left {
					font-size: 36rpx;
					font-family: PingFang-SC-Bold, PingFang-SC;
					font-weight: bold;
					color: #333333;
				}

				.tmt_right {
					display: flex;
					align-items: center;
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #FF4141;

					span {
						font-size: 24rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #333333;
						margin-right: 20rpx;
					}

					text {
						font-size: 36rpx;
						font-family: DINAlternate-Bold, DINAlternate;
						font-weight: bold;
						color: #FF4141;
					}
				}
			}

			.ti_line {
				width: 100%;
				height: 1rpx;
				background: rgba(112, 112, 112, .1);
				margin: 50rpx 0 67rpx;
			}

			.vi_box {
				border-left: 1rpx solid #ccc;
				width: calc(100% - 48rpx);
				margin: 0 24rpx;

				&>view {
					margin-top: 80rpx;
					position: relative;
					padding-left: 47rpx;

					&:first-child {
						margin-top: 0;
					}

					image {
						width: 48rpx;
						height: 48rpx;
						position: absolute;
						top: 0;
						left: -24rpx;
					}

					.vb_title {
						display: flex;
						align-items: center;

						text {
							font-size: 30rpx;
							font-family: PingFang-SC-Bold, PingFang-SC;
							font-weight: bold;
							color: #333333;

							&:last-child {
								font-size: 30rpx;
								font-family: PingFangSC-Regular, PingFang SC;
								margin-left: 36rpx;
							}
						}
					}

					.vb_tip {
						margin-top: 30rpx;
						font-size: 26rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #808080;

						&:last-child {
							margin-top: 24rpx;
						}
					}
				}
			}
		}
	}
</style>